home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / dynIntMinMax.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.5 KB  |  77 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //    dynIntMinMax.mel
  18. //  This proc contains utility routines needed by various files.
  19. //
  20.  
  21. //-----------------------  dynIntMinMax  ------------------------------
  22. //
  23. // Set the new control value in the context and adjust the intSliderGrp
  24. // range if the user has gone  beyond the current slider min/mix.
  25. //
  26. global proc dynIntMinMax(string $toolName, 
  27.                         string $contextName,
  28.                         string $controlName, 
  29.                         string $flag,
  30.                         int $fieldMin, int $fieldMax)
  31. {
  32.  
  33.     // If the user has typed in a number greater than the current
  34.     // slider range, adjust the slider range to go from 0 to twice
  35.     // the new value.
  36.     //
  37.  
  38.     // Get the new value typed in, and the current max and min.
  39.     //
  40.     int $newValue = `intSliderGrp -q -v $controlName`;
  41.     int $currMaxValue = `intSliderGrp -q -max $controlName`;
  42.     int $currMinValue = `intSliderGrp -q -min $controlName`;
  43.  
  44.     // Set the new value in the context.
  45.     //
  46.     eval($contextName+" -e "+$flag+" "+$newValue+" "+$toolName);
  47.      
  48.  
  49.     if ($newValue < $currMinValue)
  50.     {
  51.         // If the new new value is less than the current minimum,
  52.         // set the max value to 0, and the min value to newValue * 2
  53.         //
  54.         int $newMax = 0.0;
  55.         int $newMin = $newValue * 2;
  56.         intSliderGrp -e 
  57.                 -min $newMin -fmn $fieldMin
  58.                 -max $newMax -fmx $fieldMax 
  59.                 -step 1
  60.                 $controlName;
  61.     }
  62.     else if ($newValue > $currMaxValue)
  63.     {
  64.         // If the new new value is greater than the current maximum,
  65.         // set the min value to 0 and the max value to newValue * 2
  66.         //
  67.         int $newMin = 0.0;
  68.         int $newMax = $newValue * 2;
  69.         intSliderGrp -e 
  70.             -min $newMin -fmn $fieldMin
  71.             -max $newMax -fmx $fieldMax 
  72.             -step 1
  73.             $controlName;
  74.     }
  75. }
  76.  
  77.